package com.zjj.jvm2.garbageCollector;

import lombok.Data;

/**
 * @author zhanglei.zjj
 * @description 演示对象循环引用
 * @date 2023/3/15 21:17
 */
public class TestCircularReference {
    public static void main(String[] args) {
        A a1 = new A();
        A a2 = new A();

        // 循环引用
        a1.setObj(a2);
        a2.setObj(a1);

        a1 = null;
        a2 = null;

    }
}

@Data
class A {
    private Object obj;
}
